<template>
  <div class="form-layout" style="min-height: 600px">
    <!--左侧导航-->
    <div class="nav-left">
      <customAnchor :itemList="[{ name: 'box-base', title: '基础信息' }, { name: 'box-img', title: '附件' }]" />
    </div>
    <!--表单区域-->
    <div class="form-right" ref="formRight">
      <customForm :data="form" :rules="propRules" ref="editForm" :disabled="propReadonly">
        <template #content>
          <div id="box-base" class="box-title">基础信息</div>
          <customFormItem label="医院" name="hospitalId" :parent="_self" :form="form"
              :type="constCommon.formItemType.selectStatic.name" :config="{options: utilVuex.getHospitalList()}"
          />
          <customFormItem label="资质类型" name="certType" :parent="_self" :form="form"
              :type="constCommon.formItemType.selectDict.name" :config="{dictType: constCommon.dictType.certHospital}"
          />
          <customFormItem label="资质名称" name="certName" :parent="_self" :form="form" />
          <customFormItem label="资质编号" name="certCode" :parent="_self" :form="form" />
          <customFormItem label="签发方" name="certNameGet" :parent="_self" :form="form" />
          <customFormItem label="授予方" name="certNameTo" :parent="_self" :form="form" />
          <customFormItem label="有效期开始" name="certExpBegin" :parent="_self" :form="form"
            :type="constCommon.formItemType.datePicker.name"
          />
          <customFormItem label="有效期结束" name="certExpEnd" :parent="_self" :form="form"
            :type="constCommon.formItemType.datePicker.name"
          />
          <customFormItem label="禁用" name="flagDisabled" :parent="_self" :form="form"  :type="constCommon.formItemType.switch.name"/>
          <customFormItem label="备注" name="remark" :parent="_self" :form="form" />

          <div id="box-img" class="box-title">附件</div>
          <customFormItem
            label=""
            name="certFile"
            :parent="_self"
            :form="form"
            :type="constCommon.formItemType.slot.name"
            fullWidth
            style="padding-left: 10px;"
          >
            <template #content>
              <customUpload
                :data="{ fileRefId: form.id, fileRefTable: 'cert_hosup', fileSavePath: 'cert_hosup'}"
                :hide="propParent.cpFormNew"
                hideMsg="请先保存后再上传"
                :max="20"
                :disabled="propReadonly"
                multiple
                theme="file"
              />
            </template>
          </customFormItem>
        </template>
      </customForm>
    </div>
  </div>
</template>

<script>
import customAnchor from '@/components/custom/form/customAnchor.vue'
import customUpload from '@/components/custom/form/customUpload.vue'

export default {
  help: '资质维护-详情',
  data() {
    return {
      form: {},
      viewData: {},
    }
  },
  methods: {
  },
  created() {
    this.$emit('event-register', {
      validate: (callback) => {
        return this.$refs.editForm.validate(callback)
      },
      beforeSave: () => {
        this.$emit('data-callback', this.form)
        return true
      },
      afterMove: (formData) => {
        this.form = global.utils.jsonClone(formData)
        this.viewData = this.propCurrentRow

      },
      afterSave: () => {
      },
      beforeDelete: () => {
        return true
      },
      afterDelete: () => {
      },
      beforeFlow: (flowButtonKey) => {
        return true
      },
      afterFlow: (flowButtonKey) => {
      },
      beforeClose: () => {
        return true
      },
    })
  },
  props: {
    propParent: Object,
    propInitData: Object,
    propPrimaryKey: String,
    propDictionaries: Object,
    propCurrentRow: Object,
    propViewFormData: Object,
    propReadonly: Boolean,
    propStatus: String,
    propRules: Object,
  },
  components: { customAnchor, customUpload },
  computed: {},
}
</script>
